﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Corona.TagToolkit
{
    /// <summary>
    /// 类型/权值对
    /// </summary>

    public class WeightVector : Dictionary<string, long>
    {
        public override bool Equals(object obj)
        {
            WeightVector weightVector = obj as WeightVector;
            if (weightVector == null || weightVector.Count != this.Count)
                return false;
            else
            {
                try
                {
                    foreach (string key in base.Keys)
                    {
                        if (this[key] != weightVector[key])
                            return false;
                    }
                }
                catch (KeyNotFoundException e)
                {
                    return false;
                }
            }

            return true;
        }

        public override int GetHashCode()
        {
            int resault = 1;
            foreach (string key in this.Keys)
                resault ^= key.GetHashCode();
            return resault;
        }

    }





}
